#include<stdio.h>
#include<string.h>
#include<unistd.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>

int main()
{
    char s[] = "hello linux!";
    umask(0);
    int fd = open("log.txt", O_RDWR|O_CREAT|O_APPEND, 0666);
    write(fd, s, sizeof(s));
    char s2[1024];
    int fd2 = open("log.txt", O_RDONLY);
    read(fd2, s2, sizeof(s2));
    printf("%s\n", s2);
    


    return 0;
}
